<?php
class ialergias{
    public $sql;
    
    function ialergias(){
        $this->sql = new DmpSql();
    }
    
    function lista_alergias_persona($idpersona){
        $i=0;
        $sql="SELECT 
		  familia_atc.descripcion AS dfamilia_atc,
		  familia_atc.idfamilia_atc AS idfamilia_atc,
		  alergia.idpersona AS idpersona,
		  alergia.observacion AS observacion
		FROM
		  alergia
		  INNER JOIN familia_atc ON (alergia.idfamilia_atc = familia_atc.idfamilia_atc)
        WHERE
          alergia.idpersona='".$idpersona."'
		ORDER BY familia_atc.descripcion ASC";
        $resultado = $this->sql->consultar($sql,"sigh");
        
        while(!!$fila=mysql_fetch_array($resultado)){           
            $aalergia[id][$i]=$fila["idfamilia_atc"];
            $aalergia[alergia][$i]=$fila["dfamilia_atc"];
            $aalergia[idpersona][$i]=$fila["idpersona"];
            $aalergia[observacion][$i]=$fila["observacion"];            
            $i++;
        }
        return $aalergia;
    }
}
?>